<?php

class MY_Controller extends CI_Controller
{
  private $showLogin = 'false';

  public function __construct()
  {
    parent::__construct();
    $this->load->database();
    $this->load->library(array('form_validation','parser', 'session'));
    $this->load->helper(array('url', 'form'));
    $this->load->model('user', 'user_model');
  }
  
  protected function showLogin()
  {
    $this->showLogin = 'true';
  }

  protected function putTemplateArgs($arr)
  {
    return array_merge($arr,array('rootpath' => base_url(),
				  'sitepath' => site_url() . '/'));
  }

  protected function drawPage($stringPage)
  {
    $this->parser->parse('skeleton', 
			 $this->putTemplateArgs(
						array('page' => $stringPage,
						      'login_status' => (!$this->session->userdata('user_id')) ? 'false' : 'true',		      
						      'show_login' => $this->showLogin,
						      'menu' => ($this->session->userdata('user_id')) ? 
						      $this->parser->parse('user_menu', $this->putTemplateArgs(array()), true) : 
						      $this->parser->parse('public_menu', $this->putTemplateArgs(array()) , true)
						      )
						)
			 );
  }
}